//
//  TestB.m
//  Test_WWDC2018_416
//
//  Created by lianglibao on 2021/8/13.
//  Copyright © 2021 梁立保. All rights reserved.
//

#import "TestB.h"
#import <objc/message.h>

@implementation TestB
- (void)testB {
	printf("B::%s ==> self == %s\n", __func__, NSStringFromClass(self.class).UTF8String);
}

+ (void)initialize {
	static dispatch_once_t onceToken;
	dispatch_once(&onceToken, ^{
		Class classA = NSClassFromString(@"TestA");
		Class classB = NSClassFromString(@"TestB");
		Method methodA = class_getInstanceMethod(classA, @selector(testA));
		Method methodB = class_getInstanceMethod(classB, @selector(testB));
		method_exchangeImplementations(methodA, methodB);
	});
}
@end
